package com.litign.personcontrol.mapper;

import com.litign.personcontrol.pojo.Emp;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface EmpMapper {

    @Select("select count(*) from emp")
    public Long count();
//
    @Select("SELECT * FROM emp LIMIT #{start},#{pageSize};")
    public List<Emp> page(Integer start, Integer pageSize);


    //之前就是因为这个一直没有配sql，所以无法查询  后面发现和上面重复了
//    @Select("SELECT * FROM emp LIMIT #{start},#{pageSize};")
    public List<Emp> list(Integer start, Integer pageSize);

        //员工信息查询
    //@Select("select * from emp")
    public List<Emp> list(String name, Short gender, LocalDate begin, LocalDate end);

    void delete(List<Integer> ids);

    void insert(Emp emp);

    @Select("select * from emp where id=#{id}")
    Emp getById(Integer id);


    //更新员工
    void update(Emp emp);


    //根据用户名和密码查询员工
    @Select("select * from emp where username = #{username} and password = #{password}")
    Emp getByusernameandPasswd(Emp emp);
}
